home *** CD-ROM | disk | FTP | other *** search
/ Ahoy 1987 June / Ahoy_Magazine_87-06_1987_Double_L.d64 / 64 Switch Bounce (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  1KB  |  53 lines

  1. 0 rem << rr42-3 >>
  2. 100 rem=================================
  3. 110 print"[147]   switch bounce"
  4. 120 rem       rupert report #42
  5. 130 rem         for c128/c64
  6. 140 rem  use 40-column display
  7. 150 print"plug joystick into port 2"
  8. 160 print"press joystick button and see"
  9. 170 print"a display of switch bounce."
  10. 180 rem  to exit, hold run/stop then
  11. 190 rem   press joystick button
  12. 200 rem=================================
  13. 220 m=5072
  14. 230 read b$
  15. 240 if b$="xx" then 340
  16. 250 rem --------------------------------
  17. 260 rem    for c64 change line 290
  18. 270 rem     to    gosub 500
  19. 280 rem --------------------------------
  20. 290 gosub 500
  21. 300 ck=ck+b    :rem checksum
  22. 310 poke m,b
  23. 320 m=m+1
  24. 330 goto 230
  25. 340 if ck<>6226 then print"data error" : stop
  26. 350 print"use 40-column screen.  ";
  27. 360 print"put joystick into port 2. ";
  28. 370 for l=3 to 20 : print : next
  29. 380 print"press joystick button"
  30. 390 sys 5072
  31. 400 for n=1 to 38 :print" ";:next :print"[145]"
  32. 410 print"or hold run/stop & press button to exit[145]"
  33. 420 goto 390
  34. 430 end
  35. 500 rem --lines 500-600 for c64 only----
  36. 510 rem     convert hex to decimal
  37. 520 ms$=left$(b$,1)
  38. 530 ls$=right$(b$,1)
  39. 540 ms=val(ms$)
  40. 550 if ms$>="a" then ms=asc(ms$)-55
  41. 560 ls=val(ls$)
  42. 570 if ls$>="a" then ls=asc(ls$)-55
  43. 580 b=ms*16+ls
  44. 590 return
  45. 600 rem --------------------------------
  46. 5072 data a9, 00, 85, fb, a9, 04, 85, fc
  47. 5080 data a0, 00, a2, 07, a9, 10, 2c, 00
  48. 5088 data dc, d0, fb, a9, 10, 2c, 00, dc
  49. 5096 data f0, 04, a9, 31, d0, 02, a9, 30
  50. 5104 data 91, fb, c8, d0, ee, e6, fc, e4
  51. 5112 data fc, d0, e8, 60
  52. 5116 data xx
  53.